#!/usr/bin/python
# -*- coding:utf-8 -*-
class FooBar(object):
	somevar = ''
	def init(self):
		self.somevar = 'tiantian'

f = FooBar()
f.init()
print f.somevar

class NFooBar(object):
	def __init__(self, somevar):
		super(NFooBar, self).__init__()
		self.somevar = somevar
		
fn = NFooBar('ddd')
print fn.somevar

class Bird(object):
	def __init__(self):
		self.hungry = True
	def eat(self):
		if self.hungry:
			print 'Aaaah'
			self.hungry = False
		else:
			print 'No, thanks!'

class SongBird(Bird):
	def __init__(self):
		super(SongBird, self).__init__()
		Bird.__init__(self)
		self.sound = 'Squawk!'
	def sing(self):
		print self.sound

b = Bird()
b.eat()
b.eat()

sb = SongBird()
sb.sing()
sb.eat()

		
